home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #5
/
Amiga Plus CD - 2000 - No. 5.iso
/
Tools
/
Dev
/
GameboyDev
/
GBDK
/
lib
/
lsr.s
< prev
next >
Wrap
Text File
|
1999-03-29
|
398b
|
28 lines
.include "global.s"
.area _CODE
;; 16-bit logical shift right
;;
;; Entry conditions
;; BC = value to shift
;; A = number of bits to shift
;;
;; Exit conditions
;; BC = result
;;
;; Register used: AF,BC,DE,HL
.lsr16::
OR A ; Test if shift value is 0
RET Z ; If yes, return
1$:
SRL B ; Shift right
RR C
DEC A
JR NZ,1$ ; Finished?
RET
.lsr8::
LD B,#0x00
JP .lsr16